from django.shortcuts import render
from .models import OrdinaryUser
from django.views.generic import ListView, DetailView
from square.models import SparkCard
# Create your views here.


# 我的灵感类
class MySparks(ListView):
    model = SparkCard
    paginate_by = 3   # 三页一个
    template_name = 'sparkIndex/mysparks.html'  # 渲染到mysparks.html模板文件里面去
    context_object_name = 'mysparks_list'

    def get_queryset(self):
        user_id = self.request.GET.get('user_id')
        print("user_id:", user_id, self.request.GET.dict())
        return SparkCard.objects.filter(owner_id=user_id)

